*******************************************************************************
******************************  TABLE 2  **************************************
********  Effects of Group Gender Composition on Women's Influence  ***********
*******************************************************************************
clear all
set more off

*ssc install outreg2
*ssc install estout

//global root_dir "C:/Users/ganth/Dropbox/StrengthInNumbersReplicationPackage/replicable/table_2"

//cd "$root_dir"

********************************************************************************

**Table 2: Effects of Group Gender Composition on Women's Influence and Authority


**Panel 1: Team-Building Most Influential Votes
**Column 1: Study 1 Analysis

eststo clear

use "table_2_dataset_1", clear

eststo: reg genderminfl_labavg_ratio maleMajority, robust
estadd ysumm

**Column 2: Study 2 Analysis
use "table_2_dataset_2.dta", clear

eststo: reg genderminfl_ratio_r1 maleMajority, robust
estadd ysumm

**Column 3: Combined Analysis
use "table_2_dataset_3.dta", clear

eststo: reg genderminfl_ratio_ravg maleMajority, robust
estadd ysumm

esttab _all using "table_2_panel_1.tex", style(tex) ///
 stats(N r2 ymean ysd, fmt( %9.0g %9.2f  %9.2f %9.2f) ///
labels("\$N$" "\$R^2$" "Mean of outcome" "St. dev. of outcome")) label replace ///
keep(maleMajority) ///
star( * .1 ** .05 *** .01) b(%9.3f) se(%9.3f) nogaps  ///
mtitles("Study 1" "Study 2" "Studies 1 + 2") ///
nonotes nonum addnotes("\begin{minipage}{.7\linewidth} \footnotesize \smallskip \textbf{Note:} Table presents group-level analysis. In each case, the dependent variable is votes for women divided by the proportion of women in the group. All estimates are robust to the inclusion of a vector of controls (see Appendix). Study 2 analysis excludes 22 groups from the semester when the team-building task was not conducted. Heteroskedasticity-robust standard errors are reported in parentheses. Significance levels are indicated by $*$ $<.1$, ** $<.05$,  *** $<.01$.      \end{minipage}" )



**Panel 2: Team-Building Incentivized Spokesperson Votes
**Study 1 Analysis

eststo clear

use "table_2_dataset_1.dta", clear

*Column 1: Study 1 Lab Avg --- Spokesperson
eststo: reg genderspokes_labavg_ratio maleMajority, robust
estadd ysumm

**Column 2: Study 2 Analysis
use "table_2_dataset_2.dta", clear
eststo: reg genderspokes_ratio_r1 maleMajority, robust
estadd ysumm
	

**Column 3: Combined Analysis
use "table_2_dataset_3.dta", clear

eststo: reg genderspokes_ratio_ravg maleMajority, robust
estadd ysumm

	
**This creates the LaTex file for the second part of the table.
esttab _all using "table_2_panel_2.tex", style(tex) ///
 stats(N r2 ymean ysd, fmt( %9.0g %9.2f  %9.2f %9.2f) ///
labels("\$N$" "\$R^2$" "Mean of outcome" "St. dev. of outcome")) label replace ///
keep(maleMajority) ///
star( * .1 ** .05 *** .01) b(%9.3f) se(%9.3f) nogaps  ///
mtitles("Study 1" "Study 2" "Studies 1 + 2") ///
nonotes nonum addnotes("\begin{minipage}{.7\linewidth} \footnotesize \smallskip \textbf{Note:} Table presents group-level analysis. The dependent variable is the perceived influence of women divided by the proportion of women in the group. All estimates are robust to the inclusion of a vector of controls (see Appendix). Heteroskedasticity-robust standard errors are reported in parenthees. Significance levels are indicated by $*$ $<.1$, ** $<.05$,  *** $<.01$.   \end{minipage}" )

**Panel 3: Global Assessment Perceived Most Influential Votes (pre-leader assignment)
**Column 1: Study 1 Analysis

eststo clear

use "table_2_dataset_1.dta", clear
eststo clear

eststo: reg genderminfl_f2avg_ratio maleMajority, robust
estadd ysumm

	
**Column 2: Study 2 Analysis
use "table_2_dataset_2.dta", clear

eststo: reg femvotesminfl_avgpre_ratio maleMajority if genderlinfl_ravg_ratio!=., robust
estadd ysumm
	
	
**Column 3: Cobmined analysis
use "table_2_dataset_3.dta", clear

eststo: reg femvotesminfl_avgpre_ratio maleMajority if genderminfl_ratio_ravg!=., robust
estadd ysumm


**This creates the LaTex files for the 3rd part of the table
esttab _all using "table_2_panel_3.tex", style(tex) ///
 stats(N r2 ymean ysd, fmt( %9.0g %9.2f  %9.2f %9.2f) ///
labels("\$N$" "\$R^2$" "Mean of outcome" "St. dev. of outcome")) label replace ///
keep(maleMajority) ///
star( * .1 ** .05 *** .01) b(%9.3f) se(%9.3f) nogaps  ///
mtitles("Study 1" "Study 2" "Studies 1 + 2") ///
nonotes nonum addnotes("\begin{minipage}{.7\linewidth} \footnotesize \smallskip \textbf{Note:} Table presents group-level analysis. In each case, the dependent variable is votes for women divided by the proportion of women in the group. All estimates are robust to the inclusion of a vector of controls (see Appendix). Study 2 analysis excludes 22 groups from the semester when the team-building task was not conducted. Heteroskedasticity-robust standard errors are reported in parentheses. Significance levels are indicated by $*$ $<.1$, ** $<.05$,  *** $<.01$.      \end{minipage}" )

**Panel 4: Team-Building Least Influential Votes
**Column 1: Study 1 Analysis

eststo clear

use "table_2_dataset_1.dta", clear

eststo: reg genderlinfl_labavg_ratio maleMajority, robust
estadd ysumm

	
**Column 2: Study 2 Analysis
use "table_2_dataset_2.dta", clear

eststo: reg genderlinfl_ratio_r1 maleMajority, robust
estadd ysumm	
	
**Column 3: Combined Analysis
use "table_2_dataset_3.dta", clear

eststo: reg genderlinfl_ratio_ravg maleMajority, robust
estadd ysumm


**This creates the LaTex files for the 4th part of the table
esttab _all using "table_2_panel_4.tex", style(tex) ///
 stats(N r2 ymean ysd, fmt( %9.0g %9.2f  %9.2f %9.2f) ///
labels("\$N$" "\$R^2$" "Mean of outcome" "St. dev. of outcome")) label replace ///
keep(maleMajority) ///
star( * .1 ** .05 *** .01) b(%9.3f) se(%9.3f) nogaps  ///
mtitles("Study 1" "Study 2" "Studies 1 + 2") ///
nonotes nonum addnotes("\begin{minipage}{.7\linewidth} \footnotesize \smallskip \textbf{Note:} Table presents group-level analysis. In each case, the dependent variable is votes for women divided by the proportion of women in the group. All estimates are robust to the inclusion of a vector of controls (see Appendix). Study 2 analysis excludes 22 groups from the semester when the team-building task was not conducted. Heteroskedasticity-robust standard errors are reported in parentheses. Significance levels are indicated by $*$ $<.1$, ** $<.05$,  *** $<.01$.      \end{minipage}" )
